package hos.demo;

import android.app.Application;

import hos.http.Http;
import hos.http.converter.HttpStringMapListConvert;
import hos.mock.MockDispatcher;
import hos.okhttp.convert.HttpResponseJsonDataMapListConverter;
import hos.okhttp.convert.HttpResponseMapListConvert;
import hos.service.MockService;
import hos.service.TianJingWebService;
import hos.service.TrainTimeWebService;
import hos.soap.SoapFactory;

/**
 * <p>Title: App </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @version : 1.0
 * @date : 2023/3/4 0:16
 */
public class App extends Application {

    static App app;

    public static App getApp() {
        return app;
    }

    public static String url(){
        return "";
    }

    public static MockService mock() {
        return app.mock;
    }

    private final MockService mock = Http.create(MockService.class);

    public static TrainTimeWebService train() {
        return app.train;
    }
    private final TrainTimeWebService train = Http.create(TrainTimeWebService.class);

    public static TianJingWebService tianJing() {
        return app.tianJing;
    }

    private final TianJingWebService tianJing = Http.create(TianJingWebService.class);

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        Http.config().
                init(this, "http://127.0.0.1:10086",
                        new SoapFactory(),
                        new HttpResponseJsonDataMapListConverter(), BuildConfig.DEBUG, 0);
        MockDispatcher.initialize();
    }
}
